package com.projet.erp;

import com.core.common.FnKit;
import com.projet.erp.ctx.DealVO;

import java.sql.Connection;
import java.util.List;

public class SearchTableMain {
    public static void main(String[] args) {
        Connection connection = null;
        try {
            String keyword = "SW-2522";


            connection = Eco.getConn();
            List<String> oriList = TableUtil.queryAllTable(connection);
            System.out.println("原始表,个数：" + oriList.size());
            List<String> tableList = TableUtil.filter(connection, oriList, 50);
            System.out.println("过滤后,个数：" + tableList.size());
            DealVO ctx = new DealVO().setConnection(connection);
            for (int i = 0; i < tableList.size(); i++) {
                TableUtil.processTable(ctx, tableList.get(i), keyword);
                System.out.println(tableList.get(i) + " 处理完成，序号：" + (i + 1));
            }
//            System.out.println("未处理类型：" + FnKit.join(ctx.toOtherTypeList()));
            System.out.println("涉及到的表：\r\n" + FnKit.join(ctx.toResultList()));
        } catch (Exception ex) {
            ex.printStackTrace();
        } finally {
            CloseUtil.deal(connection);
        }

    }


}
